<?php

class MainMenu extends CWidget
{
	protected $items = array(
		'hotel' => array(
			'title' => 'Отели',
			'url'   => '/admin/hotel/'
		),
		'hotelfeature' => array(
			'title' => 'Фишки oтеля',
			'url'   => '/admin/hotelfeature/'
		),
		'roomfeature' => array(
			'title' => 'Фишки номера',
			'url'   => '/admin/roomfeature/'
		),
		'excursion' => array(
			'title' => 'Экскурсии',
			'url'   => '/admin/excursion/'
		),
		'pilgrim' => array(
			'title' => 'Паломнические туры',
			'url'   => '/admin/pilgrim/'
		),
		'healingtour' => array(
			'title' => 'Лечебные туры',
			'url'   => '/admin/healingtour/'
		),
		'transfer' => array(
			'title' => 'Трансфер',
			'url'   => '/admin/page/transfer/'
		),
		'vip' => array(
			'title' => 'VIP',
			'url'   => '/admin/page/vip/'
		),
		'pamyatka' => array(
			'title' => 'Памятка туристу',
			'url'   => '/admin/page/pamyatka/'
		),
		'about' => array(
			'title' => 'О нас',
			'url'   => '/admin/page/about/'
		),
		'contacts' => array(
			'title' => 'Контакты',
			'url'   => '/admin/page/contacts/'
		),
		'settings' => array(
			'title' => 'Настройки',
			'url'   => '/admin/settings/'
		),
		'logout' => array(
			'title' => 'Выход',
			'url'   => '/admin/logout/'
		)
	);

	public function run()
	{
		$controller  = $this->controller->getId();
		$activePoint = '';

		if (count($this->items) > 0) {
			foreach($this->items as $key => $item)
			{
				if ($controller == $key) {
					$activePoint = $key;
				} else if ($controller == 'page' && $_GET['alias'] == $key) {
					$activePoint = $key;
				}
			}
		}
		
		$this->render('mainMenu',array(
			'items' => $this->items,
			'activePoint' => $activePoint 
		));
	}
}